package com.itheima.job2;

import org.junit.Test;

import java.lang.reflect.Method;
import java.util.ArrayList;

public class Demo {
    @Test
    public void testArraryList(){
        ArrayList<Integer> list = new ArrayList<>();
        Class<? extends ArrayList> clz = list.getClass();
        try {
            Method add = clz.getMethod("add", Object.class);
            add.invoke(list,"success");
            System.out.println(list);
        } catch (Exception e) {
           e.printStackTrace();
        }
    }
}
